//
//  TrainingGoalSelectedCell.swift
//  DaRings
//
//  Created by 尹琼 on 2022/12/1.
//

import UIKit
import MYModule

open class TrainingGoalSelectedCell: CollectionViewCell {
    
    // 赋值默认值使用
    open var contentType: TrainingTypeContent? {
        
        didSet {
            
            titleLabel.text = "--"
            if contentType == .time {
                unitLabel.text = "gps_training_goal_setting_time_current_unit".language
            } else {
                unitLabel.text = contentType?.targetUnit
            }
        }
        
    }
    
    open var selectedItem: TrainingGoalItemModel? {
        
        didSet {
            
            guard let selectedItem = selectedItem else {
                return
            }

            let tuple = selectedItem.selectedTargetTitle
            titleLabel.text = tuple?.target
            unitLabel.text = tuple?.unit
            
        }
    }
    
    public let titleLabel = Label()
    
    public let unitLabel = Label()
    
    open override func makeUI() {
        super.makeUI()
        
        titleLabel.font = Fonts.boldSystemFont(ofSize: 50)
        unitLabel.font = Fonts.systemFont(ofSize: 20)
        titleLabel.textColor = UIColor.assist_222222
        unitLabel.textColor = UIColor.assist_222222
        
        contentView.addSubview(titleLabel)
        contentView.addSubview(unitLabel)
        
    
        titleLabel.snp.makeConstraints { make in
            make.top.equalTo(60)
            make.centerX.equalToSuperview()
        }
        
        unitLabel.snp.makeConstraints { make in
            make.top.equalTo(titleLabel.snp.bottom).offset(15)
            make.centerX.equalToSuperview()
        }
        
    
    }
    
    
    
}
